package com.njtcedu.microblog.intranet.user.web.response;

import java.io.Serializable;
import java.util.Date;
import com.njtcedu.microblog.common.entity.User;
import com.njtcedu.microblog.common.entity.UserInfo;

public class UserInfoResponse implements Serializable {
	
	private UserAccountResponse userAccount;

	private String nickName;
	
	private String gender;
	
	private String email;
	
	private String imageUrl;
	
	private Date signupDate;

	public static UserInfoResponse createUserInfo(UserInfo userInfo) {
		
		UserInfoResponse response = new UserInfoResponse();
		UserAccountResponse userAccount = new UserAccountResponse();
		
		User user = userInfo.getUser();
		userAccount.setAccount(user.getAccount());
		userAccount.setUserType(user.getUserType());
		userAccount.setId(user.getId());
		response.setUserAccount(userAccount);
		
		response.setNickName(userInfo.getNickName());
		response.setGender(userInfo.getGender());
		response.setEmail(userInfo.getEmail());
		response.setImageUrl(userInfo.getUserImage());
		response.setSignupDate(userInfo.getSignupDate());
		
		return response;
	}
	
	
	public UserAccountResponse getUserAccount() {
		return userAccount;
	}

	public void setUserAccount(UserAccountResponse userAccount) {
		this.userAccount = userAccount;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}


	public Date getSignupDate() {
		return signupDate;
	}

	public void setSignupDate(Date signupDate) {
		this.signupDate = signupDate;
	}
	
}
